module Spotify
  module Charts
    class Track
      attr_accessor :date
      attr_accessor :country
      attr_accessor :track_url
      attr_accessor :track_name
      attr_accessor :artist_name
      attr_accessor :artist_url
      attr_accessor :album_name
      attr_accessor :album_url
      attr_accessor :artwork_url
      attr_accessor :num_streams

      def ==(other)
        other.class == self.class && other.state == state
      end
      alias_method :eql?, :==

      protected

      def state
        [
          date,
          country,
          track_url,
          track_name,
          artist_name,
          album_name,
          artwork_url,
          num_streams
        ]
      end
    end
  end
end
